package com.esCore
{

	public class TesSecurityManager
	{
		public var OperID:Number=0;
		public var TeamID:Number=0;
		public var SecurityXML:XML;
		public var OperName:String="";
		public var OperCode:String="";
		public var TeamName:String="";
		public var LoginName:String="";
		public var LoginPassword:String="";
		public var SuperTag:Boolean=false;
		public var ServerDate:String;


		public function Init(aValue:XML):void
		{
			OperID=aValue.OperID;
			TeamID=aValue.TeamID;
			OperCode=aValue.OperCode;
			OperName=aValue.OperName;
			TeamName=aValue.TeamName;
			SuperTag=(aValue.SuperTag == "True") ? true : false;
			ServerDate=aValue.ServerDate;
			SecurityXML=new XML(aValue.SecurityContentXML.esFramework);
		}

		public function CheckModuleSecurity(aAppModule:String, aModuleName:String):Boolean
		{
			return ((SecurityXML[aAppModule].Security.(Module == aModuleName).Enabled == 'true') || (SuperTag)) ? true : false;
		}

		public function CheckModelSecurityInsert(aAppModule:String, aModuleName:String):Boolean
		{
			return ((SecurityXML[aAppModule].Security.(Module == aModuleName).Insert == 'true') || (SuperTag)) ? true : false;
		}

		public function CheckModelSecurityUpdate(aAppModule:String, aModuleName:String):Boolean
		{
			return ((SecurityXML[aAppModule].Security.(Module == aModuleName).Update == 'true') || (SuperTag)) ? true : false;
		}

		public function CheckModelSecurityDelete(aAppModule:String, aModuleName:String):Boolean
		{
			return ((SecurityXML[aAppModule].Security.(Module == aModuleName).Delete == 'true') || (SuperTag)) ? true : false;
		}

	}
}